package com.koylu.faces.component.validator;

import javax.faces.validator.Validator;
import javax.faces.webapp.ValidatorTag;
import javax.servlet.jsp.JspException;

public class JSFValidatorTag extends ValidatorTag {

	private String name;
	private String rel;
	private String mask;
	private String min;
	private String max;
	private String message;

	public JSFValidatorTag() {
		setValidatorId("JSFValidator");
	}

	public Validator createValidator() throws JspException {
		JSFValidator validator = (JSFValidator) super.createValidator();
		validator.setName(name);
		validator.setRel(rel);
		validator.setMask(mask);
		validator.setMin(min);
		validator.setMax(max);
		validator.setMessage(message);
		return validator;
	}

	public void release() {
		name = null;
		rel = null;
		mask = null;
		min = null;
		max = null;
		message = null;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getRel() {
		return rel;
	}

	public void setRel(String rel) {
		this.rel = rel;
	}

	public String getMask() {
		return mask;
	}

	public void setMask(String mask) {
		this.mask = mask;
	}

	public String getMin() {
		return min;
	}

	public void setMin(String min) {
		this.min = min;
	}

	public String getMax() {
		return max;
	}

	public void setMax(String max) {
		this.max = max;
	}

	public String getMessage() {
		return message;
	}

	public void setMessage(String message) {
		this.message = message;
	}

}